#pragma once
#include "WinForm.h"


WinForm::WinForm(void)
{
}


WinForm::~WinForm(void)
{
}
WinForm::WinForm(HINSTANCE instance)
{
	Register(instance);
	Create(instance);
	Show();
}
bool WinForm::Register(HINSTANCE HI)
{
	WNDCLASSEX wc;
	wc.cbSize= sizeof(WNDCLASSEX);

	wc.style= CS_HREDRAW|CS_VREDRAW;
	wc.hInstance=HI;

	wc.lpfnWndProc=(WNDPROC)WinProc;
	wc.cbClsExtra=0;
	wc.cbWndExtra=0;
	wc.hIcon=NULL;	
	wc.hCursor=LoadCursor(NULL, IDC_ARROW);
	wc.hbrBackground= (HBRUSH)GetStockObject(WHITEONBLACK);
	wc.lpszMenuName=NULL;
	wc.lpszClassName= L"TEST";
	wc.hIconSm=NULL;
	RegisterClassEx(&wc);

	return true;
}
LRESULT  CALLBACK WinForm::WinProc(HWND hwnd,UINT message, WPARAM wParam,LPARAM lParam)
{
	switch(message)
	{
	case WM_DESTROY:
		PostQuitMessage(0);
		break;
	default:
		return DefWindowProc(hwnd,message,wParam,lParam);
	}
	return 0;
}
bool WinForm::Create(HINSTANCE HI)
{
	hwnd=
		CreateWindow(
		L"TEST",
		L"COLLISON RECTANGLE",
		WS_OVERLAPPEDWINDOW,
		100,
		100,
		800,
		600,
		NULL,
		NULL,
		HI,
		NULL
		);
	if(!HI)
	{
		return false;
	}
	return true;
}
void WinForm::Show()
{
	ShowWindow(hwnd,SW_SHOWNORMAL);
	UpdateWindow(hwnd);
}
HWND WinForm::Get_HWND()
{
	return hwnd;
}